export default {
  namespaced: true,
  state: {
    address:wx.getStorageSync('address')|| '{}',
    token: wx.getStorageSync('token')||'',
    userInfo: wx.getStorageSync('userInfo')||{}
  },
  mutations: {
    //  收货地址
    UpdateAddress(state, address) {
      state.address = address
      wx.setStorage({
        key: "address",
        data: address
      })
    },
    setToken(state, token) {
      state.token = token
      wx.setStorage({
        key: "token",
        data: token
      })
    },

    updateUserInfo(state, userInfo) {
      state.userInfo = userInfo
      wx.setStorage({
        key: "userInfo",
        data: userInfo
      })
    },
    
    removeLogut(state){
      state.address={}
      state.userInfo={}
      state.token=''
      wx.clearStorage()
      
    }
  },
  getters: {
    addressInfo(state) {
      return state.address.infoAddress
    }
  }



}
